home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / doWrapArgList.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  18.6 KB  |  720 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  21 Jun 1999
  22. //  Author:         vangelis
  23. //
  24. //  Description:
  25. //      Procedures to create a wrap deformer, and add and remove influences
  26. //      from it
  27. //
  28.  
  29. proc int driverOk(string $driverTrans)
  30. //
  31. // Description:
  32. //       Checks if there are any mesh/nurbs curves/nurbs surface objects
  33. //       under the given transform
  34. {
  35.     // Find all the shapes under the given transform
  36.     //
  37.     string $shapes[] = `ls -dag -shapes $driverTrans`;
  38.  
  39.     // Find if at least one of them is an allowable influence
  40.     // type
  41.     //
  42.     string $shape;
  43.     for($shape in $shapes)
  44.     {
  45.         int $io = `getAttr ($shape+".io")`;
  46.         if ($io == 1)
  47.             continue;
  48.  
  49.         string $type = `nodeType($shape)`;
  50.         if ($type == "mesh" || $type == "nurbsCurve" || $type == "nurbsSurface")
  51.         {
  52.             return 1;
  53.         }
  54.  
  55.     }
  56.  
  57.     error("Influence objects must be polygon meshes, NURBS curves or NURBS surfaces.");
  58.  
  59.     return 0;
  60. }
  61.  
  62.  
  63. proc int plugMultiIndex(string $plug)
  64. //
  65. //  Method:   int plugMultiIndex(string $plug)
  66. //
  67. //  Description:
  68. //    Given a plug that contains a multiIndex, return the index
  69. //
  70. //    If no multiIndex is found, returns -1.
  71. //        If plug is a multi multi, returns the first multiIndex only.
  72. //
  73. {
  74.         string $buffer[], $buffer2[];
  75.         tokenize($plug,"[",$buffer);
  76.         if (size($buffer) != 2) {
  77.                 return(-1);
  78.         }
  79.         tokenize($buffer[1],"]",$buffer2);
  80.         return $buffer2[0];
  81. }
  82.  
  83. proc addInfluence(string $wrapNodeList[], string $topTrans)
  84. //
  85. // Description:
  86. //     Adds any valid influence shapes under the top transform to 
  87. //     the given wrap node
  88. //
  89. {
  90.     // Find all the control point shapes under the given transform
  91.     //
  92.     string $shapes[] = `ls -long -dag -type controlPoint $topTrans`;
  93.     
  94.     // Create all the base objects by duplicating the 
  95.     // influences
  96.     //
  97.     string $baseTransList[];
  98.     string $driverShape;
  99.     int $baseCount = 0;
  100.     for ($driverShape in $shapes)
  101.     {
  102.         int $io = `getAttr ($driverShape+".io")`;
  103.         if ($io == 1)
  104.             continue;
  105.  
  106.         // Find the parent of the shape
  107.         //
  108.         string $driverTransL[] = `listRelatives -parent -path $driverShape`;
  109.         string $driverTrans = $driverTransL[0];
  110.         
  111.         // Duplicate the driver shape
  112.         //
  113.         string $base[] = `duplicate -name ($driverTrans+"Base") $driverTrans`;
  114.         influenceRemoveSiblings($base[0], $driverShape);
  115.         $baseTransList[$baseCount++] = $base[0];
  116.         
  117.         // Hide the base surface
  118.         //
  119.         hide $base[0];
  120.     }
  121.  
  122.  
  123.     string $wrapNode;
  124.     for($wrapNode in $wrapNodeList)
  125.     {
  126.         // Get the first available connection number on the wrap 
  127.         //
  128.         int $connNum;
  129.         string $conn[] = `listConnections -p true -c true ($wrapNode + ".driverPoints")`;
  130.         if (size($conn) == 0)
  131.             $connNum = 0;
  132.         else
  133.         {
  134.             string $lastConnection = $conn[size($conn)-2];
  135.             $connNum = plugMultiIndex($lastConnection);
  136.             if ($connNum == -1)
  137.                 return;
  138.             $connNum += 1;
  139.         }
  140.         
  141.         string $driverShape;
  142.         $baseCount = 0;
  143.         for($driverShape in $shapes)
  144.         {
  145.             int $io = `getAttr ($driverShape+".io")`;
  146.             if ($io == 1)
  147.                 continue;
  148.             
  149.             string $driverType = `nodeType($driverShape)`;
  150.             if ($driverType == "mesh" || $driverType == "nurbsCurve" || $driverType == "nurbsSurface")
  151.             {
  152.                 // Find the parent of the shape
  153.                 //
  154.                 string $driverTransL[] = `listRelatives -path -parent $driverShape`;
  155.                 string $driverTrans = $driverTransL[0];
  156.                 
  157.                 
  158.                 // Add a dropoff attribute to the driver transform
  159.                 //
  160.                 string $exists[] = `listAttr -st dropoff $driverTrans`;
  161.                 if (size($exists) == 0)
  162.                 {
  163.                     addAttr -sn dr -ln dropoff -dv 4.0 -min 0.0 -max 20.0 $driverTrans;
  164.                     setAttr -k true ($driverTrans+".dr");
  165.                 }
  166.                 
  167.                 
  168.                 // Add an influence type attribute to the driver transform
  169.                 //
  170.                 if ($driverType == "mesh")
  171.                 {
  172.                     // Add the smoothness attribute to the driver transform
  173.                     //
  174.                     string $exists[] = `listAttr -st smoothness $driverTrans`;
  175.                     if (size($exists) == 0)
  176.                     {
  177.                         addAttr -sn smt -ln smoothness -dv 0.0 -min 0.0 $driverTrans;
  178.                         setAttr -k true ($driverTrans+".smt");
  179.                     }
  180.                     
  181.                     // Add the influence type attribute to the driver transform
  182.                     //
  183.                     $exists = `listAttr -st inflType $driverTrans`;
  184.                     if (size($exists) == 0)
  185.                     {
  186.                         addAttr -at short -sn ift -ln inflType -dv 2 -min 1 -max 2 $driverTrans;
  187.                         setAttr -k true ($driverTrans+".ift");
  188.                     }
  189.                     
  190.                 }
  191.                 
  192.                 if (($driverType == "nurbsCurve") || ($driverType == "nurbsSurface"))
  193.                 {
  194.                     $exists = `listAttr -st wrapSamples $driverTrans`;
  195.                     if (size($exists) == 0)
  196.                     {
  197.                         addAttr -at short -sn wsm -ln wrapSamples -dv 10 -min 1 $driverTrans;
  198.                         setAttr -k true ($driverTrans+".wsm");
  199.                     }
  200.                 }    
  201.     
  202.                 // Find the shape in the driver and base poly-surface
  203.                 //
  204.                 string $baseTrans = $baseTransList[$baseCount++];
  205.                 string $baseShapeL[]   = `listRelatives -path -c -s $baseTrans`;
  206.                 string $baseShape = $baseShapeL[0];
  207.             
  208.                 // Make the driver poly non-renderable
  209.                 //
  210.                 disableRenderabilityAttrs $driverShape;
  211.  
  212.                 // Make the connections between the shapes and the wrap node
  213.                 //
  214.                 string $tmp;
  215.                 if ($driverType == "mesh")
  216.                 {
  217.                     $tmp = ".driverPoints["+$connNum+"]";
  218.                     connectAttr ($driverShape+".worldMesh") ($wrapNode+$tmp);
  219.                     $tmp = ".basePoints["+$connNum+"]";
  220.                     connectAttr ($baseShape+".worldMesh") ($wrapNode+$tmp);
  221.                     $tmp = ".inflType["+$connNum+"]";
  222.                     connectAttr ($driverTrans+".inflType") ($wrapNode+$tmp);
  223.                     $tmp = ".smoothness["+$connNum+"]";
  224.                     connectAttr ($driverTrans+".smoothness") ($wrapNode+$tmp);
  225.                 }
  226.                 if ($driverType == "nurbsCurve" || $driverType == "nurbsSurface")
  227.                 {
  228.                     $tmp = ".driverPoints["+$connNum+"]";
  229.                     connectAttr ($driverShape+".ws") ($wrapNode + $tmp);
  230.                     $tmp = ".basePoints["+$connNum+"]";
  231.                     connectAttr ($baseShape+".ws") ($wrapNode + $tmp);
  232.                     $tmp = ".nurbsSamples["+$connNum+"]";
  233.                     connectAttr ($driverTrans+".wsm") ($wrapNode + $tmp);
  234.                 }
  235.                 
  236.                 $tmp = ".dropoff["+$connNum+"]";
  237.                 connectAttr ($driverTrans+".dropoff") ($wrapNode+$tmp);
  238.                 
  239.             }
  240.             
  241.             // Advance the connection number index
  242.             //
  243.             $connNum++;
  244.         }    
  245.     }
  246. }
  247.  
  248.  
  249. proc string[] getSelectedSurfs()
  250. //
  251. // Description:
  252. //     Loops through the selection list and finds all the shapes
  253. //     that are below the transforms.  It fills an array with 
  254. //     the parent transforms of all these shapes. 
  255. //
  256. {
  257.     string $surfs[];
  258.  
  259.     // Get the selection list
  260.     //
  261.     string $selectedItems[] = `ls -sl`;
  262.     int $numSelected = size($selectedItems);
  263.  
  264.     int $ii;
  265.     int $surfCount = 0;
  266.     string $buffer[];
  267.     for($ii=0;$ii < $numSelected - 1; $ii++)
  268.     {
  269.         clear($buffer);
  270.         string $trans = $selectedItems[$ii];
  271.         int $numTokens = tokenize($selectedItems[$ii],".",$buffer);
  272.         if ($numTokens > 0) {
  273.             $trans = $buffer[0];
  274.         }
  275.         string $isShape[] = `ls -type controlPoint $trans`;
  276.         if (0 == size($isShape)) {
  277.             if ($numTokens > 1) {
  278.                 // a component was selected
  279.                 //
  280.                 int $jj;
  281.                 int $foundSurf = 0;
  282.                 for ($jj = 0; $jj < $surfCount; $jj++) {
  283.                     clear($buffer);
  284.                     int $numTokens = tokenize($surfs[$jj],".",$buffer);
  285.                     if ($numTokens > 1) {
  286.                         if ($buffer[0] == $trans) {
  287.                             $surfs[$jj] = ($surfs[$jj]+" "+$selectedItems[$ii]);
  288.                             $foundSurf = 1;
  289.                             break;
  290.                         }
  291.                     }
  292.                 }
  293.                 if (! $foundSurf) {
  294.                     $surfs[$surfCount++] = $selectedItems[$ii];
  295.                 }
  296.             } else {
  297.                 string $surfShapes[] = `ls -dag -type controlPoint $trans`;
  298.                 string $surf;
  299.                 for($surf in $surfShapes)
  300.                 {
  301.                     // Disregard intermediate objects
  302.                     //
  303.                     int $io = `getAttr ($surf+".io")`;
  304.                     if (!$io)
  305.                     {
  306.                         string $parentL[] = `listRelatives -path -p $surf`;
  307.                         $surfs[$surfCount++] = $parentL[0];
  308.                     }
  309.                 }
  310.             }
  311.         } else {
  312.             string $rel[] = `listRelatives -path -p $trans`;
  313.             $surfs[$surfCount++] = ($rel[0]+"|"+$trans);
  314.         }
  315.     }
  316.     return $surfs;
  317. }
  318.  
  319.  
  320. proc string[] createWrap(float $threshold, float $maxDistance)
  321. //
  322. //  Description:
  323. //        Creates a new wrap node for the selected geometries
  324. //      and adds one influence object (the last element of the 
  325. //      selection list). 
  326. {
  327.     string $returnStr[];
  328.  
  329.     // Get the selection list
  330.     //
  331.     string $selectedItems[] = `ls -sl`;
  332.     int $numSelected = size($selectedItems);
  333.     
  334.     if ($numSelected < 2)
  335.     {
  336.         error("Select at least one surface and one influence object.");
  337.         return $returnStr;
  338.     }
  339.  
  340.     // The influence object is always the last element of the 
  341.     // selection list
  342.     //
  343.     string $driverTrans = $selectedItems[$numSelected-1];
  344.     
  345.     if (!driverOk($driverTrans))
  346.     {
  347.         return $returnStr;
  348.     }
  349.  
  350.     int $ii;
  351.  
  352.     string $wrapNodeList[];
  353.     int $wrapCount = 0;
  354.     
  355.     // Find all the surf transforms that have been selected
  356.     //
  357.     string $selectedSurfs[] = getSelectedSurfs();
  358.     int $numSurfs = size($selectedSurfs);
  359.  
  360.     if ($numSurfs == 0)
  361.     {
  362.         error("No deformable object selected.");
  363.         return $returnStr;
  364.     }
  365.  
  366.     // Create the wrap deformer for each surface
  367.     //
  368.     for($ii=0; $ii < $numSurfs; $ii++)
  369.     {
  370.         string $surface = $selectedSurfs[$ii];
  371.         string $surfaceShape = $surface;
  372.         string $buffer[];
  373.         int $numTokens = tokenize($surface," ",$buffer);
  374.         if ($numTokens > 0) {
  375.             string $bufferNew[];
  376.             $numTokens = tokenize($buffer[0],".",$bufferNew);
  377.             if ($numTokens > 0) {
  378.                 $buffer = `listRelatives -path -ni -type controlPoint $bufferNew[0]`;
  379.                 $surfaceShape = $buffer[0];
  380.             }
  381.         }
  382.  
  383.         string $wrapNodeL[];
  384.         if (catch($wrapNodeL =  evalEcho("deformer -type wrap "+$surface)) ||
  385.             size($wrapNodeL) == 0)
  386.         {
  387.             error("Failed to create a wrap node for " + $surface + ".");
  388.             continue;
  389.         }
  390.         string $wrapNode = $wrapNodeL[0];
  391.         $wrapNodeList[$wrapCount++] = $wrapNode;
  392.  
  393.         // Set the values for the threshold and the max distance
  394.         //
  395.         setAttr ($wrapNode + ".weightThreshold") $threshold;
  396.         setAttr ($wrapNode + ".maxDistance") $maxDistance;
  397.  
  398.         // Connect the geometry to the wrap node
  399.         //
  400.         connectAttr ($surfaceShape+".worldMatrix[0]") ($wrapNode+".geomMatrix");
  401.  
  402.         $returnStr[$ii] = $wrapNode;
  403.         
  404.     }
  405.  
  406.     // Add the influences to the wrap nodes
  407.     //
  408.     addInfluence($wrapNodeList, $driverTrans);
  409.  
  410.  
  411.     // Unselect the influence just added so that 
  412.     // the command can be easily repeated with a new influence
  413.     //
  414.     select -r $selectedItems;
  415.     select -tgl $driverTrans;
  416.  
  417.     return $returnStr;
  418. }
  419.  
  420.  
  421. proc string[]  findWrapFromSurf(string $surfTrans)
  422. //
  423. // Description:
  424. //     This procedure returns the wrap nodes that are associated
  425. //     with the given surface
  426. // 
  427. {
  428.     string $wraps[];
  429.  
  430.     string $histList[] = `listHistory $surfTrans`;
  431.     string $hist;
  432.     int $wrapCount = 0;
  433.     for($hist in $histList)
  434.     {
  435.         if (nodeType($hist) == "wrap")
  436.             $wraps[$wrapCount++] = $hist;
  437.     }
  438.     
  439.     return $wraps;
  440. }
  441.  
  442.  
  443.  
  444. proc string[] findAllSelectedWrapNodes()
  445. //
  446. // Description:
  447. //     Returns a list of all the wrap nodes that are associated 
  448. //     with the current selection list (ignoring the last element).
  449. //     The list returned also contains any wrap nodes that might be in the 
  450. //     selection list
  451. // 
  452. {
  453.     string $wrapNodeList[];
  454.     int $wrapCount = 0;
  455.  
  456.     // Get a complete list of the selected surfaces
  457.     //
  458.     string $selectedSurfs[] = getSelectedSurfs();
  459.     int $numSurfs = size($selectedSurfs);
  460.     
  461.     // find the wrap node(s) associated with each selected surface
  462.     //
  463.     int $ii;
  464.     for($ii=0; $ii < $numSurfs; $ii++)
  465.     {
  466.         string $surf = $selectedSurfs[$ii];
  467.         string $surfWraps[] = findWrapFromSurf($surf);
  468.         if (size($surfWraps)==0)
  469.         {
  470.             error("No wrap deformer is associated with surface " + $surf + ".");
  471.             continue;
  472.         }
  473.         string $surfWrap;
  474.         for ($surfWrap in $surfWraps)
  475.             $wrapNodeList[$wrapCount++] = $surfWrap;
  476.     }
  477.  
  478.     // Get any items in the selection list that are wrap nodes
  479.     // 
  480.     string $selectedWrapNodes[] = `ls -sl -type wrap`;
  481.     string $selectedWrap;
  482.     for($selectedWrap in $selectedWrapNodes)
  483.         $wrapNodeList[$wrapCount++] = $selectedWrap;
  484.  
  485.     return $wrapNodeList;
  486.  
  487. }
  488.  
  489. proc string[] addWrapInfluences()
  490. //
  491. // Description:
  492. //     Adds an influence (or multiple if a group node is selected)
  493. //     to the selected already wrapped surfaces
  494. //
  495. {
  496.     string $returnStr[];
  497.  
  498.     // Get the selection list
  499.     //
  500.     string $selectedItems[] = `ls -sl`;
  501.     int $numSelected = size($selectedItems);
  502.  
  503.     if ($numSelected < 2)
  504.     {
  505.         error("Select at least one surface (or wrap node) and one influence object.");
  506.         return $returnStr;
  507.     }
  508.  
  509.     // The influence object is always the last element of the 
  510.     // selection list
  511.     //
  512.     string $driverTrans = $selectedItems[$numSelected-1];
  513.     
  514.     if (!driverOk($driverTrans))
  515.     {
  516.         return $returnStr;
  517.     }
  518.  
  519.     // Get the wrap nodes that correspond to the current 
  520.     // selection
  521.     //
  522.     string $wrapNodeList[] = findAllSelectedWrapNodes();
  523.  
  524.     addInfluence($wrapNodeList, $driverTrans);
  525.  
  526.     // Unselect the influence just added so that 
  527.     // the command can be easily repeated with a new influence
  528.     //
  529.     select -r $selectedItems;
  530.     select -tgl $driverTrans;
  531.  
  532.     return $wrapNodeList;
  533. }
  534.  
  535.  
  536. proc removeInfluence(string $wrapNodeList[], string $topTrans)
  537. // 
  538. // Description:
  539. //     Removes the specified influence (or multiple if topTrans is 
  540. //     a group node) from the wrap nodes in the wrapNodeList.  It 
  541. //     also removes the base shape and transform if it is not used 
  542. //     anymore
  543. {
  544.     // Find all the shapes under the given transform
  545.     //
  546.     string $shapes[] = `ls -dag -leaf -shapes $topTrans`;
  547.  
  548.     string $wrapNode;
  549.     for($wrapNode in $wrapNodeList)
  550.     {
  551.         string $driverShape;
  552.         int $plugIndex;
  553.         for($driverShape in $shapes)
  554.         {
  555.             int $io = `getAttr ($driverShape+".io")`;
  556.             if ($io == 1)
  557.                 continue;
  558.  
  559.             // Find the parent of the shape
  560.             //
  561.             string $driverTransL[] = `listRelatives -parent -path $driverShape`;
  562.             string $driverTrans = $driverTransL[0];
  563.             
  564.             // Get all the connections of the driver transform
  565.             //
  566.             string $connectedNodes[] = `listConnections -s false -c true $driverTrans`;
  567.             
  568.             // Get the names of the connected attributes on the wrap node side
  569.             //
  570.             string $connectedAttrs[] = `listConnections -s false -c true -p true $driverTrans`;
  571.             
  572.             int $len = size($connectedNodes);
  573.             int $ii;
  574.             for($ii=0;$ii<$len;$ii++)
  575.             {
  576.                 // Find all the connections of the driver to the
  577.                 // given wrap node and disconnect them 
  578.                 //
  579.                 if ($connectedNodes[$ii] == $wrapNode)
  580.                 {
  581.                     string $sourcePlug = $connectedAttrs[$ii-1];
  582.                     string $destPlug   = $connectedAttrs[$ii];
  583.  
  584.                     $plugIndex = plugMultiIndex($destPlug);
  585.                     disconnectAttr($sourcePlug, $destPlug); 
  586.                 }
  587.             }
  588.             // Delete the connection to the driver shape node
  589.             //
  590.             string $driverConn[] = `listConnections -c true -p true ($wrapNode+".driverPoints["+$plugIndex+"]")`;
  591.             if (size($driverConn) == 2)
  592.                 disconnectAttr($driverConn[1], $driverConn[0]);
  593.  
  594.             // Follow the connection of the wrap node to get
  595.             // to the base shape
  596.             //
  597.             string $baseConn[] = `listConnections -c true -sh true ($wrapNode+".basePoints["+$plugIndex+"]")`;
  598.             string $baseTrans;
  599.             if (size($baseConn) == 2)
  600.             {
  601.                 string $baseShape = $baseConn[1];
  602.                 string $baseTransL[] = `listRelatives -path -parent $baseShape`;
  603.                 $baseTrans = $baseTransL[0];
  604.             }
  605.  
  606.             // delete the connection between the wrap node and 
  607.             // the base shape
  608.             $baseConn = `listConnections -c true -p true ($wrapNode+".basePoints["+$plugIndex+"]")`;
  609.             if (size($baseConn) == 2)
  610.                 disconnectAttr($baseConn[1], $baseConn[0]);
  611.                 
  612.             // Check if there are any other connections to the 
  613.             // base shape and if not then delete it
  614.             //
  615.             if ($baseTrans != "")
  616.             {
  617.                 // Find if there are any other connections to the geometry
  618.                 // of the base shape and if not then remove the base shape
  619.                 //
  620.                 string $connectionsLeft[] = `listConnections $baseConn[1]`;
  621.                 if (size($connectionsLeft) == 0)
  622.                     delete $baseTrans;
  623.             }
  624.         }
  625.     }
  626. }
  627.  
  628.             
  629.         
  630.     
  631.  
  632. proc string[] removeWrapInfluence()
  633. //
  634. // Description:
  635. //     Removes an influence (or multiple if a group node is selected)
  636. //     from the selected wrapped surfaces
  637. //
  638. {
  639.     string $returnStr[];
  640.  
  641.     // Get the selection list
  642.     //
  643.     string $selectedItems[] = `ls -sl`;
  644.     int $numSelected = size($selectedItems);
  645.  
  646.     if ($numSelected < 2)
  647.     {
  648.         error("Select at least one surface (or wrap node) and one influence object.");
  649.         return $returnStr;
  650.     }
  651.  
  652.     // The influence object is always the last element of the 
  653.     // selection list
  654.     //
  655.     string $driverTrans = $selectedItems[$numSelected-1];
  656.  
  657.     // Get all the corresponding wrap nodes
  658.     //
  659.     string $wrapNodeList[] = findAllSelectedWrapNodes();
  660.  
  661.     removeInfluence($wrapNodeList, $driverTrans);
  662.  
  663.     // Unselect the influence just removed so that 
  664.     // the command can be easily repeated with a new influence
  665.     //
  666.     select -r $selectedItems;
  667.     select -tgl $driverTrans;
  668.  
  669.     return $wrapNodeList;
  670. }
  671.  
  672.  
  673. global proc string [] doWrapArgList( string $version,
  674.                                      string $args[] )
  675. //  Description:
  676. //        Starting point of all wrap operations
  677. //
  678. //  Input Arguments:
  679. //      version:  The version used.  1.0 is pre Maya 2.5
  680. //        args[]:
  681. //        [0]  : operation:  1 - Create a new wrap
  682. //                           2 - Add influence
  683. //                           3 - Remove influence
  684. //        [1]  : threshold:  The weight threshold to be used when creating 
  685. //                           a wrap
  686. //        [2]  : maxDist  :  The maxDistance to be used when creating a wrap
  687. //
  688. //  Return Value:
  689. //      [string] The name of the wrap node involved in the operation
  690. //
  691. {
  692.     int $operation   = $args[0];
  693.     float $threshold;
  694.     float $maxDist;
  695.  
  696.     if ( $version == "1" )
  697.     {
  698.         $threshold = 0.0;
  699.         $maxDist   = 0.0;
  700.     }
  701.     else
  702.     {
  703.         $threshold = $args[1];
  704.         $maxDist   = $args[2];
  705.     }
  706.  
  707.     if ($operation == 1) 
  708.     {
  709.         return createWrap($threshold, $maxDist);
  710.     }
  711.     if ($operation == 2)
  712.     {
  713.         return addWrapInfluences();
  714.     }
  715.     if ($operation == 3)
  716.     {
  717.         return removeWrapInfluence();
  718.     }
  719. }
  720.